package com.ocm.tourism.core.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.ocm.tourism.core.domain.Business;
import com.ocm.tourism.core.domain.BusinessType;
import com.ocm.tourism.core.domain.CulinaryCulture;
import com.ocm.tourism.core.domain.FoodStall;
import com.ocm.tourism.core.domain.Hotel;

@Service("businessParticipantService")
public class BusinessParticipantServiceImpl extends BusinessServiceImpl implements BusinessParticipantService {

   public Business findBusiness(Long id, Long participantId) {
      return businessDao.findByPartcipantId(id, participantId);
   }

   @Override
   public long countHotels(Long participantId) {
      long count = this.hotelDao.count(participantId);
      return count;
   }
   
   @Override
   public List<Hotel> findHotels(int firstResult, int maxResults, Long participantId) {
      List<Hotel> businesses = this.hotelDao.findAll(firstResult, maxResults, participantId);
      return businesses;
   }

   @Override
   public boolean hasExisted(Long id, Long participantId) {
      boolean existed = businessDao.hasExisted(id, participantId);
      return existed;
   }

   @Override
   public long countRestaurants(Long participantId) {
      long count = this.culinaryCultureDao.count(BusinessType.RESTAURANT, participantId);
      return count;
   }

   @Override
   public List<CulinaryCulture> findRestaurants(int firstResult, int maxResults, Long participantId) {
      List<CulinaryCulture> businesses = this.culinaryCultureDao.find(firstResult, maxResults, BusinessType.RESTAURANT, participantId);
      return businesses;
   }

   @Override
   public long countCoffees(Long participantId) {
      long count = this.culinaryCultureDao.count(BusinessType.COFFEE, participantId);
      return count;
   }

   @Override
   public List<CulinaryCulture> findCoffees(int firstResult, int maxResults, Long participantId) {
      List<CulinaryCulture> businesses = this.culinaryCultureDao.find(firstResult, maxResults, BusinessType.COFFEE, participantId);
      return businesses;
   }

   @Override
   public long countFoodStalls(Long participantId) {
      long count = this.culinaryCultureDao.count(BusinessType.FOODSTALL, participantId);
      return count;
   }

   @Override
   public List<FoodStall> findFoodStalls(int firstResult, int maxResults, Long participantId) {
      List<FoodStall> businesses = this.culinaryCultureDao.findFoodStalls(firstResult, maxResults, participantId);
      return businesses;
   }
}
